package com.ruoyi.web.controller.ring;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ring.domain.RingStressChangeInfo;
import com.ruoyi.ring.service.IRingStressChangeInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 压力信息
 * 
 * @author liuwp
 * @date 2025-09-08
 */
@RestController
@RequestMapping("/ring/ring_stress_change_info")
public class RingStressChangeInfoController extends BaseController
{
    @Resource
    private IRingStressChangeInfoService ringStressChangeInfoService;

    /**
     * 查询压力信息列表
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change_info:list')")
    @GetMapping("/list")
    public TableDataInfo list(RingStressChangeInfo ringStressChangeInfo)
    {
        startPage();
        List<RingStressChangeInfo> list = ringStressChangeInfoService.selectRingStressChangeInfoList(ringStressChangeInfo);
        return getDataTable(list);
    }

    /**
     * 导出压力信息列表
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change_info:export')")
    @Log(title = "压力信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RingStressChangeInfo ringStressChangeInfo)
    {
        List<RingStressChangeInfo> list = ringStressChangeInfoService.selectRingStressChangeInfoList(ringStressChangeInfo);
        ExcelUtil<RingStressChangeInfo> util = new ExcelUtil<RingStressChangeInfo>(RingStressChangeInfo.class);
        util.exportExcel(response, list, "压力信息数据");
    }

    /**
     * 获取压力信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change_info:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(ringStressChangeInfoService.selectRingStressChangeInfoById(id));
    }

    /**
     * 新增压力信息
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change_info:add')")
    @Log(title = "压力信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RingStressChangeInfo ringStressChangeInfo)
    {
        return toAjax(ringStressChangeInfoService.insertRingStressChangeInfo(ringStressChangeInfo));
    }

    /**
     * 修改压力信息
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change_info:edit')")
    @Log(title = "压力信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RingStressChangeInfo ringStressChangeInfo)
    {
        return toAjax(ringStressChangeInfoService.updateRingStressChangeInfo(ringStressChangeInfo));
    }

    /**
     * 删除压力信息
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change_info:remove')")
    @Log(title = "压力信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ringStressChangeInfoService.deleteRingStressChangeInfoByIds(ids));
    }

}
